<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/21
 * Time: 21:56
 */

namespace Xcx\Model;

class VideoDanmuModel extends CommonModel
{

    public function addDanmu($vid, $content, $times)
    {
        $data['uid'] = $this->getUid();
        $data['vid'] = $vid;
        $data['content'] = $content;
        $data['times'] = $times;
        $data['add_time'] = time();

        return $this->data($data)->add();
    }

    public function getDanmuList($vid)
    {
        $maps['vid'] = $vid;
        $maps['state'] = '1';

        $list = $this->where($maps)->order(array('times'=>'asc'))->select();
        if (is_array($list) && count($list) > 0) {
            return $list;
        }
        return array();
    }

}